Skip to content

Instantiable logger, customizable serialization, unit tests and more#14

Open
jxai wants to merge 10 commits intorxi:masterfrom
jxai:master
Open

Instantiable logger, customizable serialization, unit tests and more#14
jxai wants to merge 10 commits intorxi:masterfrom
jxai:master

Conversation

@jxai
Copy link

@jxai jxai commented Mar 18, 2026

  • Supports creating an independent instances with its own config, and optionally a name (if specified the name appears in log output):
local logger = log{name="mymod", level="warn", usecolor=false}
logger.info("my info log")

Original global logger still works exactly as it used to be

  • Customizable serializer:
local inspect = require "inspect"
log.tostr = function(v) return inspect(v, {newline=" ", indent="", depth=2}) end
log.info({ key = "value" })
-- [INFO  14:32:01] src.lua:2: { key = "value" }
  • Optionally logs to stderr, useful when stdout should not be used
  • Added a suite of unit tests, just run lua test.lua
  • Disabled log levels are automatically assigned a noop function instead of checking the level on every call - more efficient (and transparent to the user)
  • Other minor fixes

@jxai jxai changed the title Named and customized logger instance, unit tests, performance improvements and fixes Named and customized logger instance, unit tests, performance improvement Mar 18, 2026
@jxai jxai changed the title Named and customized logger instance, unit tests, performance improvement Named and customized logger instance, unit tests, performance improvement and fixes Mar 18, 2026
@jxai jxai changed the title Named and customized logger instance, unit tests, performance improvement and fixes Named and customizable logger instance; customizable serialization; unit tests, perf improvement and fixes Mar 20, 2026
@jxai jxai changed the title Named and customizable logger instance; customizable serialization; unit tests, perf improvement and fixes Instantiable logger, customizable serialization, unit tests, perf improvement and fixes Mar 20, 2026
@jxai jxai changed the title Instantiable logger, customizable serialization, unit tests, perf improvement and fixes Instantiable logger, customizable serialization, unit tests, and more Mar 20, 2026
@jxai jxai changed the title Instantiable logger, customizable serialization, unit tests, and more Instantiable logger, customizable serialization, unit tests and more Mar 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant